//
//  ViewController.m
//  作业_朱紫明01
//
//  Created by dllo on 16/6/4.
//  Copyright © 2016年 zuzhiming. All rights reserved.
//

#define SCREEN_WIDTH [UIScreen mainScreen].bounds.size.width
#define SCREEN_HEIGHT [UIScreen mainScreen].bounds.size.height

#import "ViewController.h"

@interface ViewController ()

@property (nonatomic, retain) UIView *CustomView;

@end

@implementation ViewController

- (void)dealloc
{
    [_CustomView release];
    [super dealloc];
}

- (void)viewDidLoad {
    [super viewDidLoad];
    
    
    
    //加载视图
    [self createCustomView];
    
}

/**
 *  创建随机色视图
 */
- (void)createCustomView
{
    
    for (NSInteger i = 0; i < 5; i++) {
        for (NSInteger j = 0; j < 8; j++) {
            self.CustomView = [[UIView alloc] initWithFrame:CGRectMake(SCREEN_WIDTH / 5 * i, SCREEN_HEIGHT / 8 * j, SCREEN_WIDTH / 5, SCREEN_HEIGHT / 8)];
            self.CustomView.backgroundColor = [UIColor colorWithRed:arc4random() % 255 / 256.0 green:arc4random() % 255 / 256.0 blue:arc4random() % 255 / 256.0 alpha:1];
            
            [self.view addSubview:_CustomView];
            [_CustomView release];
        }
    }
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
